insert a node at the tail of a linked list hackerrank solution